﻿<Page x:Class="XamlTorrent.Configuration"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Settings" Height="Auto" Width="Auto">
    <DockPanel>
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button>Apply</Button>
            <Button>Reset</Button>
            <Button>Reset Defaults</Button>
        </StackPanel>
        <TreeView Name="treeSettings" DockPanel.Dock="Top">
            <TreeViewItem Header="Network Connections" IsExpanded="True">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="50" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <CheckBox Name="cbxAllowLegacyConn" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" />
                    <Label Grid.Column="0" Grid.Row="0" Target="{Binding ElementName=cbxAllowLegacyConn}" ToolTip="Enables compatibility with legacy peer clients which do not support encryption.">Allow Un_encrypted Connections</Label>
                    
                    <TextBox x:Name="maxConn" Grid.Column="1" Grid.Row="1" />
                    <Label Grid.Column="0" Grid.Row="1" Target="{Binding ElementName=maxConn}">Maximum Total _Connection</Label>

                    <TextBox x:Name="maxHalfConn" Grid.Column="1" Grid.Row="2" />
                    <Label Grid.Column="0" Grid.Row="2" Target="{Binding ElementName=maxHalfConn}">Maximum _Half-Open Connections</Label>

                    <TextBox x:Name="maxDownSpeed" Grid.Column="1" Grid.Row="3" />
                    <Label Grid.Column="0" Grid.Row="3" Target="{Binding ElementName=maxDownSpeed}" ToolTip="Maxumum combined download speed in kilobytes per second.">Maximum _Download Speed (KB/s)</Label>

                    <TextBox x:Name="maxUpSpeed" Grid.Column="1" Grid.Row="4" />
                    <Label Grid.Column="0" Grid.Row="4" Target="{Binding ElementName=maxUpSpeed}" ToolTip="Maxumum combined upload speed in kilobytes per second.">Maximum _Upload Speed (KB/s)</Label>

                    <TextBox x:Name="listenPort" Grid.Column="1" Grid.Row="5" />
                    <Label Grid.Column="0" Grid.Row="5" Target="{Binding ElementName=listenPort}" ToolTip="XamlTorrent listens on this port for incoming connections from other peers.">_Port</Label>
                </Grid>
            </TreeViewItem>
            <TreeViewItem Header="Local Storage" IsExpanded="True">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition MinWidth="300" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    
                    <TextBox Name="txtWorkDir" Grid.Column="2" Grid.Row="0">
                        <TextBox.Text>
                            <Binding Path="Text">
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <Label Grid.Column="1" Grid.Row="0" Target="{Binding ElementName=txtWorkDir}" Content="Default Download Folder" ToolTip="Storage for unfinished files and other temporary data." />
                    <Button Name="btnWorkDir" Grid.Column="3" Content="..." Padding="5" Click="btnWorkDir_Click" />
                    
                    <CheckBox Name="cbxDownloadDir" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" />
                    <TextBox Name="txtDownloadDir" Grid.Column="2" Grid.Row="1" IsEnabled="{Binding ElementName=cbxDownloadDir, Path=IsChecked}" />
                    <Label Grid.Column="1" Grid.Row="1" Target="{Binding ElementName=txtDownloadDir}" IsEnabled="{Binding ElementName=cbxDownloadDir, Path=IsChecked}" Content="Completed Download Directory" ToolTip="Where to store downloaded files." />
                    <Button Name="btnDownloadDir"  Padding="5" Grid.Column="3" Grid.Row="1" Content="..." IsEnabled="{Binding ElementName=cbxDownloadDir, Path=IsChecked}" Click="btnDownloadDir_Click" />
                    
                    <CheckBox Name="cbxTorrentDir" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" />
                    <TextBox Name="txtTorrentDir" Grid.Column="2" Grid.Row="2" IsEnabled="{Binding ElementName=cbxTorrentDir, Path=IsChecked}" />
                    <Label Grid.Column="1" Grid.Row="2" Target="{Binding ElementName=txtTorrentDir}" IsEnabled="{Binding ElementName=cbxTorrentDir, Path=IsChecked}" Content="Torrent Directory" ToolTip="Torrent files (*.torrent) in this directory are automatically loaded at startup." />
                    <Button Name="btnTorrentDir" Padding="5" Grid.Column="3" Grid.Row="2" Content="..." IsEnabled="{Binding ElementName=cbxTorrentDir, Path=IsChecked}" Click="btnTorrentDir_Click" />
                </Grid>
            </TreeViewItem>
            <TreeViewItem Header="Application Settings" />
        </TreeView>
    </DockPanel>
</Page>
